#ifndef __BLUETOOTH_H__
#define __BLUETOOTH_H__

#include "GPIO.h"
#include "UART.h"
#include "NVIC.h"
#include "Switch.h"
#include "structs.h"

#define BT_EN		P03
#define BT_RXD		P10
#define BT_TXD		P11
#define BT_STATE	P02

typedef struct
{
	u8 frame_header;
	u8 cmd;
	u8 data_len;
	u8 data_[20];
	u8 frame_footer;
}Command;

static u8 uart2_tx_buf[30];

void BT_init();
void BT_receive_data();

extern void BT_send_byte(u8 dat);
extern void BT_send_data(char* str, int len);
extern void BT_send_packet(Command* temp_command);
void BT_parse_data(u8* buffer,int buffer_index);

extern void BT_set_timer_alarm(u8 cmd ,u8 hour ,u8 minute ,u8 second);
extern void BT_set_clock_date(Clock_t date);
void BT_control_HMI(u8 temp);
extern void BT_date_reporting(Clock_t temp);
extern void BT_humiture_reporting(u8 humidity, float temperature);

#endif